<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

<rich:panel header="#{messages['member.agreement.list']}">
	<h:panelGrid ><h:outputText value="#{errorBean.errorMessage}" styleClass="error"></h:outputText></h:panelGrid>
	
 	<t:panelGrid  rendered="#{adminMemberAgreementMgmtBean.userAccountSuspended}" columns="1">
		<h:outputText value="#{messages['user.suspended.msg']}" styleClass="error"/>
		<t:commandButton value="#{messages['reactivate.action.button']}" action="#{adminMemberAgreementMgmtBean.reActivateUserAccountAction}" 
			actionListener="#{adminMemberAgreementMgmtBean.reActivateUserAccountListener}" styleClass="button">
		</t:commandButton>	
    </t:panelGrid>	

	<t:panelGrid columns="2">
		<h:outputLabel value="#{messages['member.name.label']}" styleClass="standardText_Label" />
		<h:outputText value="#{adminMemberAgreementMgmtBean.member.name}" styleClass="standardText" />
		
		<h:outputLabel value="#{messages['member.type']}" styleClass="standardText_Label" />
		<h:outputText value="#{adminMemberAgreementMgmtBean.member.memberTypeLabel}" styleClass="standardText" />
		
		<h:outputLabel value="#{messages['membership.no.label']}" styleClass="standardText_Label" />
		<h:outputText value="#{adminMemberAgreementMgmtBean.member.membershipNo}"styleClass="standardText" />
		
	</t:panelGrid>
	
	<rich:spacer height="10" />


	<rich:dataTable id="data" var="agreement" value="#{adminMemberAgreementMgmtBean.agreementList}" rows="20" width="99%" >
		<rich:column style="text-align:center;width:35%;" >
			<f:facet name="header">
				<h:outputText value="#{messages['agreement.no']}"></h:outputText>
			</f:facet>
			<h:outputText value="#{agreement.agreetmentNo}"></h:outputText>
		</rich:column>
		<rich:column style="text-align:center;width:35%;">
			<f:facet name="header">
				<h:outputText value="#{messages['membership']}"></h:outputText>
			</f:facet>
			<h:outputText value="#{agreement.membership.name}"></h:outputText>
		</rich:column>
		<rich:column style="text-align:center;width:15%;">
			<f:facet name="header">
				<h:outputText value="#{messages['view.transaction']}"></h:outputText>
			</f:facet>
			<t:commandButton value="#{messages['action']}" action="#{adminMemberAgreementMgmtBean.navViewPointAction}" 
			actionListener="#{adminMemberAgreementMgmtBean.navViewPointActionListener}" styleClass="button"></t:commandButton>
			<f:param value="#{agreement.agreementId}" id="agreementId"/>
		</rich:column>
<%-- 
		<rich:column style="text-align:center;width:15%;">
			<f:facet name="header">
				<h:outputText value="#{messages['view.invoice']}"></h:outputText>
			</f:facet>
			<t:commandButton value="#{messages['action']}" styleClass="button" action="#{adminMemberAgreementMgmtBean.navViewAgreementInvoiceAction}" 
			actionListener="#{adminMemberAgreementMgmtBean.navViewAgreementInvoiceActionListener}"></t:commandButton>
			<f:param value="#{agreement.agreementId}" id="vagreementId"/>
		</rich:column>
		--%>
		<rich:column style="text-align:center;width:13%;">
			<f:facet name="header">
				<h:outputText value="Change Membership"></h:outputText>
			</f:facet>
			<h:commandButton styleClass="button" value="#{messages['action']}" 
			action="#{adminMemberAgreementMgmtBean.changeMembershipAction}" actionListener="#{adminMemberAgreementMgmtBean.changeMembershipActionListener}"
			immediate="true"></h:commandButton>
			
			<f:param id="agreementId2" value="#{agreement.agreementId}"/>
		</rich:column>
		<rich:column style="text-align:center;width:13%;">
			<f:facet name="header">
				<h:outputText value="Reschedule"></h:outputText>
			</f:facet>
			<h:commandButton styleClass="button" value="#{messages['action']}" rendered="#{agreement.installmentSchema!=null && ! (agreement.installmentSchema.month==1)}"
			action="#{adminMemberAgreementMgmtBean.rescheduleAction}" actionListener="#{adminMemberAgreementMgmtBean.rescheduleActionListener}"
			immediate="true"></h:commandButton>
			
			<f:param id="agreementId3" value="#{agreement.agreementId}"/>
		</rich:column>
	</rich:dataTable>
	
	<rich:spacer height="30"></rich:spacer>
	
	<rich:datascroller align="left"  for="data" maxPages="20" />
	<rich:spacer height="60"></rich:spacer>
	
	<h:commandButton styleClass="button" value="Add New Agreement" 
			action="#{adminMemberAgreementMgmtBean.navIndSelectAction}"  
			></h:commandButton>
	
</rich:panel>
